package beikecode;

/**
 * Created by JiaJia on 2019/7/23 0023.
 */
public class TestA03 {
    private static int nextBeautifulNUm(int num){
        int newNum=num+1;
        while (!isBeautifulNum(newNum)){
            newNum++;
        }
        return newNum;

    }
    private static boolean isBeautifulNum(int number){
        int a=number%10;
        number/=10;
        int b=number%10;
        number/=10;
        int c=number%10;
        int d=number/10;
        if ((a!=b)&&(a!=c)&&(a!=d)&&(b!=c)&&(b!=d)&&(c!=d)){
            return true;
        }
        return false;

    }

    public static void main(String[] args) {
        System.out.println(nextBeautifulNUm(1987));
        System.out.println(nextBeautifulNUm(2013));
    }

}